<?xml version="1.0" encoding="UTF-8"?>
<ClinicalDocument xmlns="urn:hl7-org:v3" xmlns:mif="urn:hl7-org:v3/mif" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
                  xsi:schemaLocation="urn:hl7-org:v3 ..\sdschemas\SDA.xsd">

    <!--地域代码，  "CN" 代表中国-->
    <realmCode code="CN"/>
    <typeId root="2.16.840.1.113883.1.3" extension="POCD_MT000040"/>
    <templateId root="2.16.156.10011.2.1.1.2"/>
    <!--文档编号 [1..1]  -->
    <id root="2.16.156.10011.1.1.1.1" extension="${docData.wenDangBH}"/>
    <!--文档分类代码-->
    <code code="HSDB01.01" codeSystem="2.16.156.10011.2.4" codeSystemName="卫生信息共享文档编码体系"/>
    <title>出生医学证明</title>
    <!--文档生效时间 [1..1]-->
    <effectiveTime value="${docData.effectiveTime}"/>
    <!--文档密级[1..1] -->
    <confidentialityCode code="N" codeSystem="2.16.840.1.113883.5.25" codeSystemName="Confidentiality"
                         displayName="正常访问保密级别"/>
    <!--文档语言 [1..1]  默认值 code="zh-CN" 含义：中文字符编码-->
    <languageCode code="zh-CN"/>
    <setId/>
    <versionNumber/>

    <!--文档记录对象（新生儿）[1]  -->
    <recordTarget contextControlCode="OP" typeCode="RCT">
        <patientRole classCode="PAT">
            <id root="2.16.156.10011.1.9" extension="${docData.patientRole.chuShengYXZMBH}"/>
            <patient classCode="PSN" determinerCode="INSTANCE">
                <#if docData.patientRole.patient.id??>
                    <id root="2.16.156.10011.1.3" extension="${docData.patientRole.patient.id}"/>
                </#if>
                <name>${docData.chuShengXSR.xingMing}</name>
                <!--性别 -->
                <administrativeGenderCode code="${docData.chuShengXSR.xingBie.code}"
                                          displayName="${docData.chuShengXSR.xingBie.displayName}"
                                          codeSystem="2.16.156.10011.2.3.3.4"
                                          codeSystemName="生理性别代码表(GB/T 2261.1)"/>
                <!-- 出生日期  时间要求精确到分-->
                <birthTime xsi:type="TS" value="${docData.chuShengXSR.chuShengRQ}"/>
                <!--监护人-->
                <#list docData.chuShengXSR.jianHuR as item>
                    <guardian>
                        <code code="${item.codeObject.code}" displayName="${item.codeObject.displayName}"
                              codeSystem="2.16.156.10011.2.3.3.8"
                              codeSystemName="家庭关系代码表(GB/T 4761)"/>
                        <!-- 监护人（父亲）住址 -->
                        <addr use="H">
                            <houseNumber>${item.menPaiHao}</houseNumber>
                            <streetName>${item.jieDao}</streetName>
                            <township>${item.zhen}</township>
                            <county>${item.xian}</county>
                            <city>${item.shi}</city>
                            <state>${item.sheng}</state>
                        </addr>
                        <guardianPerson>
                            <name>${item.jianHuRXM}</name>
                        </guardianPerson>
                    </guardian>
                </#list>
                <!--出生地-->
                <birthplace>
                    <place classCode="PLC" determinerCode="INSTANCE">
                        <addr use="H">
                            <houseNumber>${docData.chuShengXSR.menPaiHao}</houseNumber>
                            <streetName>${docData.chuShengXSR.jieDao}</streetName>
                            <township>${docData.chuShengXSR.zhen}</township>
                            <county>${docData.chuShengXSR.qu}</county>
                            <city>${docData.chuShengXSR.shi}</city>
                            <state>${docData.chuShengXSR.sheng}</state>
                        </addr>
                    </place>
                </birthplace>
            </patient>
        </patientRole>
    </recordTarget>

    <!--文档创作者  [1..*] -->
    <author typeCode="AUT" contextControlCode="OP">
        <time xsi:type="TS" value="${docData.chuangJianZ.fangShiRQ}"/>
        <assignedAuthor classCode="ASSIGNED">
            <id root="2.16.156.10011.1.7" extension="${docData.chuangJianZ.chuanJianZId}"/>
            <assignedPerson>
                <name>${docData.chuangJianZ.suiFangYSXM}</name>
            </assignedPerson>
            <representedOrganization>
                <id root="2.16.156.10011.1.5" extension="${docData.chuangJianZ.hospitalId}"/>
                <name>${docData.chuangJianZ.hospitalName}</name>
            </representedOrganization>
        </assignedAuthor>
    </author>

    <!--文档管理机构信息[1..1] -->
    <#include "fragment/header/custodian.ftl">

    <!-- 签发日期和机构 -->
    <legalAuthenticator>
        <!-- 签发日期 -->
        <time value="${docData.qianFaRQ}"></time>
        <signatureCode></signatureCode>
        <assignedEntity>
            <id/>
            <representedOrganization>
                <name>${docData.qianFaJGMC}</name>
            </representedOrganization>
        </assignedEntity>
    </legalAuthenticator>

    <component>
        <structuredBody>

            <!-- 主要健康问题章节-->
            <component>
                <section>
                    <code code="11450-4" codeSystem="2.16.840.1.113883.6.1" codeSystemName="LOINC"
                          displayName="PROBLEM LIST"/>
                    <text>主要健康问题</text>
                    <!--条目：出生孕周-->
                    <entry>
                        <observation classCode="OBS" moodCode="EVN">
                            <code code="DE02.10.006.00" displayName="出生孕周"
                                                                          codeSystem="2.16.156.10011.2.2.1"
                                                                          codeSystemName="卫生信息数据元目录"/>
                            <value xsi:type="PQ" value="${docData.zhuYaoJKWT.yunZhou}" unit="周"/>
                        </observation>
                    </entry>

                    <!--条目：健康状况代码:1.良好 2.一般 3.差-->
                    <entry>
                        <observation classCode="OBS" moodCode="EVN">
                            <code code="DE05.10.034.00" displayName="健康状况代码"
                                  codeSystem="2.16.156.10011.2.2.1" codeSystemName="卫生信息数据元目录"/>
                            <value xsi:type="CD" code="${docData.zhuYaoJKWT.jianKangZK.code}" codeSystem="2.16.156.10011.2.3.2.60" codeSystemName="健康状况代码表"
                                   displayName="${docData.zhuYaoJKWT.jianKangZK.displayName}"/>
                        </observation>
                    </entry>
                </section>
            </component>

            <!--生命体征章节-->
            <component>
                <section>
                    <code code="8716-3" codeSystem="2.16.840.1.113883.6.1" codeSystemName="LOINC"
                          displayName="VITAL SIGNS"/>
                    <text>生命体征</text>
                    <!--条目：出生身长-->
                    <entry>
                        <observation classCode="OBS" moodCode="EVN">
                            <code code="DE04.10.018.00" codeSystem="2.16.156.10011.2.2.1" codeSystemName="卫生信息数据元目录"
                                  displayName="出生身长"/>
                            <value xsi:type="PQ" value="${docData.shengMingTZ.chuShengSC}" unit="cm"/>
                        </observation>
                    </entry>
                    <!--条目：出生体重-->
                    <entry>
                        <observation classCode="OBS" moodCode="EVN">
                            <code code="DE04.10.019.00" codeSystem="2.16.156.10011.2.2.1" codeSystemName="卫生信息数据元目录"
                                  displayName="出生体重"/>
                            <value xsi:type="PQ" value="${docData.shengMingTZ.chuShengTZ}" unit="g"/>
                        </observation>
                    </entry>
                </section>
            </component>

            <!--章节：母亲-->
            <component>
                <section>
                    <code code="52" displayName="母亲" codeSystem="2.16.156.10011.2.3.3.8"
                          codeSystemName="家庭关系代码表（GB/T 4761）"/>
                    <subject contextControlCode="OP">
                        <relatedSubject>
                            <subject>
                                <name>${docData.muQin.xingMing}</name>
                                <birthTime value="${docData.muQin.chuShengRQ}"/>
                            </subject>
                        </relatedSubject>
                    </subject>
                    <!--条目：国籍-->
                    <entry>
                        <observation classCode="OBS" moodCode="DEF">
                            <code code="DE02.01.015.00" displayName="母亲国籍"
                                                                          codeSystem="2.16.156.10011.2.2.1"
                                                                          codeSystemName="卫生信息数据元目录"/>
                            <value xsi:type="CD" code="${docData.muQin.guoJi.code}" displayName="${docData.muQin.guoJi.displayName}"
                                   codeSystem="2.16.156.10011.2.3.3.1" codeSystemName="世界各国和地区名称代码(GB/T 2659)"/>
                        </observation>
                    </entry>
                    <!--条目：民族-->
                    <entry>
                        <observation classCode="OBS" moodCode="DEF">
                            <code code="DE02.01.025.00" displayName="母亲民族" codeSystem="2.16.156.10011.2.2.1"
                                  codeSystemName="卫生信息数据元目录"/>
                            <value xsi:type="CD" code="${docData.muQin.minZu.code}" displayName="${docData.muQin.minZu.displayName}"
                                   codeSystem="2.16.156.10011.2.3.3.3" codeSystemName="民族类别代码表(GB 3304)"/>
                        </observation>
                    </entry>
                    <!--条目：身份证件号码-->
                    <entry>
                        <observation classCode="OBS" moodCode="DEF">
                            <code code="DE02.01.030.00" displayName="母亲身份证件号码"
                                  codeSystem="2.16.156.10011.2.2.1" codeSystemName="卫生信息数据元目录"/>
                            <value xsi:type="ST">${docData.muQin.shengFenZHM}</value>
                        </observation>
                    </entry>
                </section>
            </component>

            <!--章节：父亲-->
            <component>
                <section>
                    <code code="51" displayName="父亲" codeSystem="2.16.156.10011.2.3.3.8"
                          codeSystemName="家庭关系代码表（GB/T 4761）"/>
                    <subject contextControlCode="OP">
                        <relatedSubject>
                            <subject>
                                <name>${docData.fuQin.xingMing}</name>
                                <birthTime value="${docData.fuQin.chuShengRQ}"/>
                            </subject>
                        </relatedSubject>
                    </subject>
                    <!--条目：国籍-->
                    <entry>
                        <observation classCode="OBS" moodCode="DEF">
                            <code code="DE02.01.015.00" displayName="父亲国籍"
                                                                          codeSystem="2.16.156.10011.2.2.1"
                                                                          codeSystemName="卫生信息数据元目录"/>
                            <value xsi:type="CD" code="${docData.fuQin.guoJi.code}" displayName="${docData.fuQin.guoJi.displayName}"
                                   codeSystem="2.16.156.10011.2.3.3.1" codeSystemName="世界各国和地区名称代码(GB/T 2659)"/>
                        </observation>
                    </entry>
                    <!--条目：民族-->
                    <entry>
                        <observation classCode="OBS" moodCode="DEF">
                            <code code="DE02.01.025.00" displayName="父亲民族"
                                                                          codeSystem="2.16.156.10011.2.2.1"
                                                                          codeSystemName="卫生信息数据元目录"/>
                            <value xsi:type="CD" code="${docData.fuQin.minZu.code}" displayName="${docData.fuQin.minZu.displayName}"
                                   codeSystem="2.16.156.10011.2.3.3.3" codeSystemName="民族类别代码表(GB 3304)"/>
                        </observation>
                    </entry>
                    <!--条目：身份证件号码-->
                    <entry>
                        <observation classCode="OBS" moodCode="DEF">
                            <code code="DE02.01.030.00" displayName="父亲身份证件号码"
                                  codeSystem="2.16.156.10011.2.2.1" codeSystemName="卫生信息数据元目录"/>
                            <value xsi:type="ST">${docData.fuQin.shengFenZHM}</value>
                        </observation>
                    </entry>
                </section>
            </component>

            <!-- 接生相关信息章节 -->
            <component>
                <section>
                    <code displayName="接生相关信息"/>
                    <text>接生相关信息</text>
                    <!--条目：出生地类别代码-->
                    <entry>
                        <observation classCode="OBS" moodCode="EVN">
                            <code code="DE02.01.004.00" displayName="出生地类别代码"
                                  codeSystem="2.16.156.10011.2.2.1" codeSystemName="卫生信息数据元目录"/>
                            <value code="${docData.jieShengXX.chuShengD.code}"  displayName="${docData.jieShengXX.chuShengD.displayName}" codeSystem="2.16.156.10011.2.3.1.2" codeSystemName="出生(分娩)地点类别代码表"
                                   xsi:type="CD"/>
                        </observation>
                    </entry>

                    <!--签章人：接生人员-->
                    <entry>
                        <observation classCode="OBS" moodCode="EVN">
                            <code code="DE02.01.039.00" displayName="助产人员"
                                                                          codeSystem="2.16.156.10011.2.2.1"
                                                                          codeSystemName="卫生信息数据元目录"/>
                            <value xsi:type="ST">${docData.jieShengXX.jieShengRXM}</value>
                        </observation>
                    </entry>

                    <!--签章机构：接生单位-->
                    <entry>
                        <observation classCode="OBS" moodCode="EVN">
                            <code code="DE08.10.013.00" displayName="助产机构"

                                  codeSystem="2.16.156.10011.2.2.1" codeSystemName="卫生信息数据元目录"/>
                            <value xsi:type="ST">${docData.jieShengXX.jieShengDWMC}</value>
                        </observation>
                    </entry>
                </section>
            </component>
        </structuredBody>
    </component>
</ClinicalDocument>
